package com.gitee.ly.ymorm.mapping.builder;

import com.gitee.ly.ymorm.YmOrmConfig;
import com.gitee.ly.ymorm.mapping.BoundSql;
import com.gitee.ly.ymorm.mapping.ParamMap;
import com.gitee.ly.ymorm.mapping.SqlSource;

import java.util.List;

/**
 * StaticSqlSource
 *
 * @author ly
 **/
public class StaticSqlSource implements SqlSource {
    private final String sql;
    private final List<String> parameterMappings;
    private final YmOrmConfig configuration;

    public StaticSqlSource(YmOrmConfig configuration, String sql) {
        this(configuration, sql, null);
    }

    public StaticSqlSource(YmOrmConfig configuration, String sql, List<String> parameterMappings) {
        this.sql = sql;
        this.configuration = configuration;
        this.parameterMappings = parameterMappings;
    }

    @Override
    public BoundSql getBoundSql(ParamMap parameterObject) {
        return new BoundSql(configuration, sql, parameterMappings, parameterObject);
    }

}
